﻿using Architecture.Api.Application.Commands.SourceCommand;
using Architecture.Domain.Services.Interface;
using Architecture.Domian.DTO;
using Architecture.Repository.Interface;
using MediatR;

namespace Architecture.Api.Application.CommandHandlers.SourceHandler
{
    public class SourceQueryPicListCommandHandler : IRequestHandler<SourceQueryPicListCommand, List<PictureDTO>>
    {
        private readonly ISourceService _sourceService;

        public SourceQueryPicListCommandHandler(ISourceService sourceService)
        {
            _sourceService = sourceService;
        }

        async Task<List<PictureDTO>> IRequestHandler<SourceQueryPicListCommand, List<PictureDTO>>.Handle(SourceQueryPicListCommand request, CancellationToken cancellationToken)
        {
            return await _sourceService.GetPicture(request.production);
        }
    }
}
